﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EelSwap
{
    public partial class Form1 : Form
    {

        Eel george;
        Eel paul;

        public Form1()
        {
            InitializeComponent();
            george = new Eel { Name = "George", Length = 24 };
            paul = new Eel { Name = "Paul", Length = 36 };
        }

        private void button1_Click(object sender, EventArgs e)
        {
            george.WhoAmI();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            paul.WhoAmI();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            /// To perform a swap amongst object references, you create a placeholder reference to hold the object of the reference that your going to move
            /// away initially to prevent the object from being removed by garbage collection. You then move the reference your placeholder is occupying to
            /// its destination. You then move the final reference to the destination that the placeholder is holding.
            Eel placeholder;
            placeholder = george;
            george = paul;
            paul = placeholder;
            MessageBox.Show("Swap Confirmed!", "Eel Swappin'.");
        }
    }
}
